package com.consumer.user.controller;

import com.consumer.user.service.ConsumerMainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 类描述：用户登录获取信息的实现类
 * @author linzf
 */
@RestController
@RequestMapping(value = "/auth")
public class ConsumerMainController {

    @Autowired
    private ConsumerMainService consumerMainService;

    /**
     * 功能描述：根据用户登录成功以后的token来查找用户的数据
     * @param entity
     * @return
     */
    @PostMapping("getUserInfo")
    public Map<String,Object> getUserInfo(@RequestBody Map<String,Object> entity){
        return consumerMainService.getUserInfo(entity);
    }

    /**
     * 功能描述：根据用户的账号和密码实现用户的登录功能
     * @param entity
     * @return
     */
    @PostMapping("login")
    public Map<String,Object> login(@RequestBody Map<String,Object> entity){
        return consumerMainService.login(entity);
    }

}
